import 'package:flutter/material.dart';
import 'package:portal_website/pages/common_header.dart';
import 'package:portal_website/pages/three/talent_cultivation.dart';
import 'package:portal_website/tool/image_network.dart';

class InsurancePage extends StatelessWidget {
  const InsurancePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xFFF5F9FF),
      body: SingleChildScrollView(
        child: Container(
          margin: EdgeInsets.only(top: 50),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Breadcrumb(text: "首页 > 服务平台 > 金融/保险"),

              PageTitle(
                title: '金融/保险服务',
                subtitle: "专业金融与保险解决方案，助力企业稳健发展和风险防控",
              ),

              // 内容区域
              Container(
                constraints: const BoxConstraints(maxWidth: 1200),
                padding: const EdgeInsets.all(20),
                child: Column(
                  children: [
                    // 服务概览
                    const OverviewSection(),

                    // 金融服务
                    const FinanceSection(),

                    // 保险服务
                    const InsuranceServiceSection(),

                    // 合作伙伴
                    const PartnerSection(),

                    // 成功案例
                    const CasesSection(),
                  ],
                ),
              ),

              // 页脚
              const Footer(
                email: 'finance@innovationservice.com',
              ),
            ],
          ),
        ),
      ),
    );
  }
}

// 服务概览
class OverviewSection extends StatelessWidget {
  const OverviewSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
        boxShadow: [
          BoxShadow(
            color: Colors.black12,
            blurRadius: 15,
            offset: const Offset(0, 3),
          ),
        ],
      ),
      padding: const EdgeInsets.all(40),
      margin: const EdgeInsets.only(bottom: 40),
      child: Column(
        children: [
          SectionTitle(text: '金融与保险服务概述'),
          const SizedBox(height: 30),
          LayoutBuilder(
            builder: (context, constraints) {
              if (constraints.maxWidth > 768) {
                return Row(
                  children: [
                    Expanded(
                      child: Column(
                        children: const [
                          Text(
                            '创新服务平台整合优质金融与保险资源，为企业提供全方位的金融解决方案和风险管理服务。我们与多家银行、保险公司和投资机构建立了战略合作关系，能够为企业提供定制化的金融与保险服务。',
                            style: TextStyle(
                              color: Color(0xFF555555),
                              fontSize: 16,
                              height: 1.8,
                            ),
                            textAlign: TextAlign.justify,
                          ),
                          SizedBox(height: 20),
                          Text(
                            '金融服务涵盖企业融资、投资管理、财务顾问等多个领域；保险服务包括财产保险、责任保险、员工福利保险等全方位保障。我们的专业团队拥有丰富的行业经验，能够根据企业实际情况，设计最优的金融与保险方案。',
                            style: TextStyle(
                              color: Color(0xFF555555),
                              fontSize: 16,
                              height: 1.8,
                            ),
                            textAlign: TextAlign.justify,
                          ),
                          SizedBox(height: 20),
                          Text(
                            '平台已服务超过500家企业，累计促成金融交易金额超过50亿元，保险保障金额超过100亿元，客户满意度达98%。',
                            style: TextStyle(
                              color: Color(0xFF555555),
                              fontSize: 16,
                              height: 1.8,
                            ),
                            textAlign: TextAlign.justify,
                          ),
                        ],
                      ),
                    ),
                    const SizedBox(width: 40),
                    ClipRRect(
                      borderRadius: BorderRadius.circular(8),
                      child: ImageNetwork(
                        '',
                        width: 500,
                        height: 300,
                        fit: BoxFit.cover,
                      ),
                    ),
                  ],
                );
              } else {
                return Column(
                  children: [
                    Column(
                      children: const [
                        Text(
                          '创新服务平台整合优质金融与保险资源，为企业提供全方位的金融解决方案和风险管理服务。我们与多家银行、保险公司和投资机构建立了战略合作关系，能够为企业提供定制化的金融与保险服务。',
                          style: TextStyle(
                            color: Color(0xFF555555),
                            fontSize: 16,
                            height: 1.8,
                          ),
                          textAlign: TextAlign.justify,
                        ),
                        SizedBox(height: 20),
                        Text(
                          '金融服务涵盖企业融资、投资管理、财务顾问等多个领域；保险服务包括财产保险、责任保险、员工福利保险等全方位保障。我们的专业团队拥有丰富的行业经验，能够根据企业实际情况，设计最优的金融与保险方案。',
                          style: TextStyle(
                            color: Color(0xFF555555),
                            fontSize: 16,
                            height: 1.8,
                          ),
                          textAlign: TextAlign.justify,
                        ),
                        SizedBox(height: 20),
                        Text(
                          '平台已服务超过500家企业，累计促成金融交易金额超过50亿元，保险保障金额超过100亿元，客户满意度达98%。',
                          style: TextStyle(
                            color: Color(0xFF555555),
                            fontSize: 16,
                            height: 1.8,
                          ),
                          textAlign: TextAlign.justify,
                        ),
                      ],
                    ),
                    const SizedBox(height: 20),
                    ClipRRect(
                      borderRadius: BorderRadius.circular(8),
                      child: ImageNetwork(
                        '',
                        width: double.infinity,
                        height: 300,
                        fit: BoxFit.cover,
                      ),
                    ),
                  ],
                );
              }
            },
          ),
        ],
      ),
    );
  }
}

// 金融服务
class FinanceSection extends StatelessWidget {
  const FinanceSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
        boxShadow: [
          BoxShadow(
            color: Colors.black12,
            blurRadius: 15,
            offset: const Offset(0, 3),
          ),
        ],
      ),
      padding: const EdgeInsets.all(40),
      margin: const EdgeInsets.only(bottom: 40),
      child: Column(
        children: [
          SectionTitle(text: '金融服务'),
          const SizedBox(height: 10),
          const Text(
            '全方位的金融解决方案，满足企业不同发展阶段的资金需求',
            style: TextStyle(
              color: Color(0xFF666666),
              fontSize: 16,
            ),
          ),
          const SizedBox(height: 30),
          Column(
            children: const [
              FinanceItem(
                imageUrl: 'https://via.placeholder.com/300x200?text=企业融资',
                title: '企业融资服务',
                description:
                    '我们与多家银行和非银行金融机构合作，为企业提供多样化的融资解决方案，包括银行贷款、债券发行、融资租赁、供应链金融等。我们的专业团队将根据企业实际情况，设计最优融资方案，帮助企业降低融资成本，提高融资效率。',
                features: '服务特点：多渠道融资对接、个性化方案设计、全程专业指导',
                scenarios: '适用场景：企业扩张、设备采购、流动资金补充、项目投资等',
              ),
              FinanceItem(
                imageUrl: 'https://via.placeholder.com/300x200?text=投资管理',
                title: '投资管理服务',
                description:
                    '提供专业的投资管理和财务顾问服务，包括投资项目评估、投资组合管理、财务规划等。我们的投资专家团队拥有丰富的市场经验，能够帮助企业制定科学的投资策略，实现资产保值增值。',
                features: '服务特点：专业投资分析、风险控制、资产配置优化',
                scenarios: '适用场景：企业闲置资金管理、战略投资、并购重组等',
              ),
              FinanceItem(
                imageUrl: 'https://via.placeholder.com/300x200?text=财务顾问',
                title: '财务顾问服务',
                description:
                    '为企业提供全面的财务顾问服务，包括财务战略规划、资本结构优化、税务筹划等。我们的财务专家将深入分析企业财务状况，提供专业建议，帮助企业提升财务管理水平，实现财务目标。',
                features: '服务特点：全方位财务诊断、定制化解决方案、持续跟踪服务',
                scenarios: '适用场景：企业战略规划、上市准备、财务体系优化等',
              ),
            ],
          ),
        ],
      ),
    );
  }
}

// 金融服务项
class FinanceItem extends StatelessWidget {
  final String imageUrl;
  final String title;
  final String description;
  final String features;
  final String scenarios;

  const FinanceItem({
    super.key,
    required this.imageUrl,
    required this.title,
    required this.description,
    required this.features,
    required this.scenarios,
  });

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.only(bottom: 30),
      child: LayoutBuilder(
        builder: (context, constraints) {
          if (constraints.maxWidth > 768) {
            return Row(
              children: [
                ClipRRect(
                  borderRadius: BorderRadius.circular(8),
                  child: ImageNetwork(
                    "",
                    width: 300,
                    height: 200,
                    fit: BoxFit.cover,
                  ),
                ),
                const SizedBox(width: 30),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        title,
                        style: const TextStyle(
                          fontSize: 20,
                          color: Color(0xFF1E5799),
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      const SizedBox(height: 15),
                      Text(
                        description,
                        style: const TextStyle(
                          color: Color(0xFF555555),
                          fontSize: 15,
                          height: 1.8,
                        ),
                      ),
                      const SizedBox(height: 10),
                      Text(
                        features,
                        style: const TextStyle(
                          color: Color(0xFF555555),
                          fontSize: 15,
                          height: 1.8,
                        ),
                      ),
                      const SizedBox(height: 10),
                      Text(
                        scenarios,
                        style: const TextStyle(
                          color: Color(0xFF555555),
                          fontSize: 15,
                          height: 1.8,
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            );
          } else {
            return Column(
              children: [
                ClipRRect(
                  borderRadius: BorderRadius.circular(8),
                  child: ImageNetwork(
                    "",
                    width: double.infinity,
                    height: 200,
                    fit: BoxFit.cover,
                  ),
                ),
                const SizedBox(height: 20),
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      title,
                      style: const TextStyle(
                        fontSize: 20,
                        color: Color(0xFF1E5799),
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    const SizedBox(height: 15),
                    Text(
                      description,
                      style: const TextStyle(
                        color: Color(0xFF555555),
                        fontSize: 15,
                        height: 1.8,
                      ),
                    ),
                    const SizedBox(height: 10),
                    Text(
                      features,
                      style: const TextStyle(
                        color: Color(0xFF555555),
                        fontSize: 15,
                        height: 1.8,
                      ),
                    ),
                    const SizedBox(height: 10),
                    Text(
                      scenarios,
                      style: const TextStyle(
                        color: Color(0xFF555555),
                        fontSize: 15,
                        height: 1.8,
                      ),
                    ),
                  ],
                ),
              ],
            );
          }
        },
      ),
    );
  }
}

// 保险服务
class InsuranceServiceSection extends StatelessWidget {
  const InsuranceServiceSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
        boxShadow: [
          BoxShadow(
            color: Colors.black12,
            blurRadius: 15,
            offset: const Offset(0, 3),
          ),
        ],
      ),
      padding: const EdgeInsets.all(40),
      margin: const EdgeInsets.only(bottom: 40),
      child: Column(
        children: [
          SectionTitle(text: '保险服务'),
          const SizedBox(height: 10),
          const Text(
            '全面的风险保障方案，为企业稳健发展保驾护航',
            style: TextStyle(
              color: Color(0xFF666666),
              fontSize: 16,
            ),
          ),
          const SizedBox(height: 30),
          GridView.count(
            shrinkWrap: true,
            physics: const NeverScrollableScrollPhysics(),
            crossAxisCount: MediaQuery.of(context).size.width > 768 ? 3 : 1,
            crossAxisSpacing: 30,
            mainAxisSpacing: 30,
            childAspectRatio: 300 / 300,
            children: const [
              InsuranceCard(
                icon: '🏢',
                title: '财产保险',
                description:
                    '为企业财产提供全方位保障，包括火灾保险、自然灾害保险、机器损坏保险等，覆盖企业固定资产、存货、设备等各类财产风险。',
              ),
              InsuranceCard(
                icon: '👨‍💼',
                title: '责任保险',
                description: '保障企业因经营活动可能产生的法律责任风险，包括公众责任险、产品责任险、雇主责任险、职业责任险等。',
              ),
              InsuranceCard(
                icon: '👥',
                title: '员工福利保险',
                description:
                    '为企业员工提供全面的福利保障，包括团体健康保险、意外伤害保险、养老保险等，提升员工福利，增强企业吸引力。',
              ),
              InsuranceCard(
                icon: '✈️',
                title: '贸易信用保险',
                description: '保障企业在贸易往来中的信用风险，包括买方破产、拖欠货款等风险，帮助企业安全开展贸易活动。',
              ),
              InsuranceCard(
                icon: '🛡️',
                title: '网络安全保险',
                description: '保障企业因网络攻击、数据泄露等网络安全事件导致的损失，包括数据恢复费用、法律责任赔偿等。',
              ),
              InsuranceCard(
                icon: '📦',
                title: '物流运输保险',
                description:
                    '保障企业在货物运输过程中的风险，包括货物损失、运输工具损坏等，覆盖海运、陆运、空运等多种运输方式。',
              ),
            ],
          ),
        ],
      ),
    );
  }
}

// 保险服务卡片
class InsuranceCard extends StatelessWidget {
  final String icon;
  final String title;
  final String description;

  const InsuranceCard({
    super.key,
    required this.icon,
    required this.title,
    required this.description,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: const Color(0xFFF9FBFF),
        borderRadius: BorderRadius.circular(8),
        border: Border.all(color: const Color(0xFFE0E9FF)),
      ),
      padding: const EdgeInsets.all(30),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            icon,
            style: const TextStyle(fontSize: 48),
          ),
          const SizedBox(height: 20),
          Text(
            title,
            style: const TextStyle(
              fontSize: 18,
              color: Color(0xFF1E5799),
              fontWeight: FontWeight.bold,
            ),
          ),
          const SizedBox(height: 15),
          Text(
            description,
            maxLines: 3,
            style: const TextStyle(
              color: Color(0xFF666666),
              fontSize: 14,
              height: 1.7,
            ),
          ),
          const SizedBox(height: 20),
          TextButton(
            onPressed: () {},
            style: TextButton.styleFrom(
              padding: EdgeInsets.zero,
              tapTargetSize: MaterialTapTargetSize.shrinkWrap,
            ),
            child: const Text(
              '了解详情 →',
              style: TextStyle(
                color: Color(0xFF207CCA),
                fontWeight: FontWeight.bold,
                fontSize: 14,
              ),
            ),
          ),
        ],
      ),
    );
  }
}

// 合作伙伴
class PartnerSection extends StatelessWidget {
  const PartnerSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
        boxShadow: [
          BoxShadow(
            color: Colors.black12,
            blurRadius: 15,
            offset: const Offset(0, 3),
          ),
        ],
      ),
      padding: const EdgeInsets.all(40),
      margin: const EdgeInsets.only(bottom: 40),
      child: Column(
        children: [
          SectionTitle(text: '合作伙伴'),
          const SizedBox(height: 10),
          const Text(
            '我们与多家知名金融机构和保险公司建立了战略合作关系',
            style: TextStyle(
              color: Color(0xFF666666),
              fontSize: 16,
            ),
          ),
          const SizedBox(height: 30),
          Wrap(
            alignment: WrapAlignment.center,
            spacing: 30,
            runSpacing: 30,
            children: const [
              PartnerItem(
                imageUrl: 'https://via.placeholder.com/150x60?text=工商银行',
                name: '工商银行',
              ),
              PartnerItem(
                imageUrl: 'https://via.placeholder.com/150x60?text=建设银行',
                name: '建设银行',
              ),
              PartnerItem(
                imageUrl: 'https://via.placeholder.com/150x60?text=中国银行',
                name: '中国银行',
              ),
              PartnerItem(
                imageUrl: 'https://via.placeholder.com/150x60?text=平安保险',
                name: '平安保险',
              ),
              PartnerItem(
                imageUrl: 'https://via.placeholder.com/150x60?text=中国人保',
                name: '中国人保',
              ),
              PartnerItem(
                imageUrl: 'https://via.placeholder.com/150x60?text=太平洋保险',
                name: '太平洋保险',
              ),
            ],
          ),
        ],
      ),
    );
  }
}

// 合作伙伴项
class PartnerItem extends StatelessWidget {
  final String imageUrl;
  final String name;

  const PartnerItem({
    super.key,
    required this.imageUrl,
    required this.name,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 180,
      height: 100,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
        boxShadow: [
          BoxShadow(
            color: Colors.black12,
            blurRadius: 15,
            offset: const Offset(0, 5),
          ),
        ],
      ),
      padding: const EdgeInsets.all(20),
      child: Center(
        child: ImageNetwork(
          "",
          fit: BoxFit.contain,
        ),
      ),
    );
  }
}

// 成功案例
class CasesSection extends StatelessWidget {
  const CasesSection({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(8),
        boxShadow: [
          BoxShadow(
            color: Colors.black12,
            blurRadius: 15,
            offset: const Offset(0, 3),
          ),
        ],
      ),
      padding: const EdgeInsets.all(40),
      margin: const EdgeInsets.only(bottom: 40),
      child: Column(
        children: [
          SectionTitle(text: '成功案例'),
          const SizedBox(height: 10),
          const Text(
            '我们已为众多企业提供了优质的金融与保险服务',
            style: TextStyle(
              color: Color(0xFF666666),
              fontSize: 16,
            ),
          ),
          const SizedBox(height: 30),
          GridView.count(
            shrinkWrap: true,
            physics: const NeverScrollableScrollPhysics(),
            crossAxisCount: MediaQuery.of(context).size.width > 768 ? 3 : 1,
            crossAxisSpacing: 30,
            mainAxisSpacing: 30,
            childAspectRatio: 300 / 360,
            children: const [
              CaseCard(
                imageUrl: 'https://via.placeholder.com/400x200?text=科技企业融资',
                title: '某科技企业融资服务',
                description:
                    '为该科技企业设计融资方案，成功获得1亿元银行贷款，利率低于市场平均水平，支持企业研发投入和市场拓展。',
              ),
              CaseCard(
                imageUrl: 'https://via.placeholder.com/400x200?text=制造企业保险',
                title: '制造企业综合保险方案',
                description:
                    '为制造企业设计全方位保险方案，涵盖财产险、责任险和员工福利险，年保费节省20%，保障范围扩大30%。',
              ),
              CaseCard(
                imageUrl: 'https://via.placeholder.com/400x200?text=贸易企业信用保险',
                title: '贸易企业信用保险服务',
                description: '为贸易企业提供信用保险服务，保障金额5000万元，帮助企业安全拓展国际市场，降低应收账款风险。',
              ),
            ],
          ),
        ],
      ),
    );
  }
}
